package pritace

import "fmt"

type Animal interface {
	Run()
	Eat()

}
type cat struct {
	Name string
	age int

}
type dog struct {
	Name string

}

func (c cat) Run() {
	fmt.Printf("%s开始跑", c.Name)
}
func (c cat)Eat()  {
	fmt.Printf("%s开始吃", c.Name)

}
func (d dog) Run() {
	fmt.Printf("%s开始跑", d.Name)
}
func (d dog)Eat()  {
	fmt.Printf("%s开始吃", d.Name)

}

func TestStruct()  {
	//var a Animal
	//c := dog{
	//	Name: "小白",
	//}
	//a = c
	//a.Eat()
	c := dog{
		Name: "小白",
	}
	MyRun2(c)
	l.Run()
}

func MyRun1(a Animal)  {
	a.Eat()
	a.Run()
}

var l Animal
func MyRun2(a Animal)  {
	l = a
}